Some strange behavior with XMLRPC server
Hi! I'm a newbie of bitbake community!
Recently, I'm trying to implement XMLRPC client for bitbake command(this is similar to tinfoil). As I do this activity, I found the following strange behavior.
---
# getRecipePackages commands returns collections.defaultdict object, but it's not supported by XMLRPCServer This is as the title says. The following two places may help you understand. Isn't this a glitch?
* getRecipePackages command returns command.cooker.recipecaches[mc].packages(See https://git.yoctoproject.org/poky/tree/bitbake/lib/bb/command.py#n343 ) ( https://git.yoctoproject.org/poky/tree/bitbake/lib/bb/command.py#n343 )
* command.cooker.recipecaches[mc].packages is set as defaultdict(list) (See https://git.yoctoproject.org/poky/tree/bitbake/lib/bb/cache.py#n153 )
This causes an exception when calling getRecipePackages commands. See the attached log file. We can fix this by returning as a dict object.
``` return dict(command.cooker.recipecaches[mc].packages) ```
# getLayerPriorities command clears recipescache
I noticed that getLayerPriorities command deletes cache data because getLayerPriorities calls cooker.parseConfiguration(), and this deletes cooker.recipecaches. Is this behavior as intended?
1. getLayerPriorities command calls command.cooker.parseConfiguration()(See https://git.yoctoproject.org/poky/tree/bitbake/lib/bb/command.py#n298 )
2. parseConfiguration deletes recipecaches(See https://git.yoctoproject.org/poky/tree/bitbake/lib/bb/cooker.py#n467 )
Therefore, If user calls commands by following order, the results of the third and fifth getRecipes are different because the fourth getLayerPriorities clears the cache.
1. parseConfiguration command
2. parseFiles command
3. getRecipes command <- user can get info normaly 3. getLayerPriorities command
4. getRecipes command <- user can get empty info!
---
This is my first post to this mailing list, so please forgive me if I am rude in any way. Thanks for reading!
Quoted 46 lines · On Wed, 2022-07-27 at 08:49 -0700, [email protected] wrote:
Hi! I'm a newbie of bitbake community!
Recently, I'm trying to implement XMLRPC client for bitbake command(this is similar to tinfoil).
As I do this activity, I found the following strange behavior.---
# getRecipePackages commands returns collections.defaultdict object, but it's not supported by XMLRPCServer
This is as the title says. The following two places may help you understand. Isn't this a glitch?* getRecipePackages command
returns command.cooker.recipecaches[mc].packages(See
https://git.yoctoproject.org/poky/tree/bitbake/lib/bb/command.py#n343
)
* command.cooker.recipecaches[mc].packages is set as defaultdict(list) (See
https://git.yoctoproject.org/poky/tree/bitbake/lib/bb/cache.py#n153)This causes an exception when calling getRecipePackages commands. See the attached log file.
We can fix this by returning as a dict object.``` return dict(command.cooker.recipecaches[mc].packages) ```# getLayerPriorities command clears recipescache
I noticed thatgetLayerPrioritiescommand deletes cache data becausegetLayerPrioritiescallscooker.parseConfiguration(), and this deletes cooker.recipecaches.
Is this behavior as intended?1. getLayerPriorities command calls command.cooker.parseConfiguration()(See
https://git.yoctoproject.org/poky/tree/bitbake/lib/bb/command.py#n298
)
2. parseConfiguration deletes
recipecaches(See https://git.yoctoproject.org/poky/tree/bitbake/lib/b
b/cooker.py#n467)Therefore, If user calls commands by following order, the results of the third and fifth getRecipes are different because the fourth getLayerPriorities clears the cache.
Quoted 6 lines
1. parseConfiguration command
2. parseFiles command
3. getRecipes command <- user can get info normaly 3. getLayerPriorities command
4. getRecipes command <- user can get empty info!
Looking at the code, parseConfiguration is designed to only be called once at the start of parsing. I think you have therefor found a bug in the getLayerPriorities() command which shouldn't be calling it, or should have some kind of guard on the call.
Cheers,
Richard